package com.sn.system.tangs.tag;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.UIBean;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;

import com.opensymphony.xwork2.util.ValueStack;

@StrutsTag(name = "Msg", tldTagClass = "jp.co.sn.system.tangs.tag.MsgTag", description = "Msg")
public class Msg extends UIBean{

	public Msg(ValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		super(stack, request, response);
	}

	private String id;
	
	private String msg;
	
	private String okFunction;
	
	private String focusOn;
	
	private String value;
	
	private String title;
	
	

	@StrutsTagAttribute(description = "set id", type = "id")
	public void setId(String id) {
		this.id = id;
	}
	@StrutsTagAttribute(description = "set msg", type = "String")
	public void setMsg(String msg) {
		this.msg = msg;
	}
	@StrutsTagAttribute(description = "set okFunction", type = "String")
	public void setOkFunction(String okFunction) {
		this.okFunction = okFunction;
	}
	@StrutsTagAttribute(description = "set focusOn", type = "String")
	public void setFocusOn(String focusOn) {
		this.focusOn = focusOn;
	}
	@StrutsTagAttribute(description = "set value", type = "String")
	public void setValue(String value) {
		this.value = value;
	}
	
	@StrutsTagAttribute(description = "set title", type = "String")
	public void setTitle(String title) {
		this.title = title;
	}	

	protected String getDefaultTemplate() {
		return "Msg";
	}	
	

	/**
	 * パラメータを設定する
	 */
	protected void evaluateExtraParams() {
		super.evaluateExtraParams();
		if (null != id) {
			addParameter("id", findString(id));
		}
		if (null != msg) {
			addParameter("msg", findString(msg));
		}
		if (null != okFunction) {
			addParameter("okFunction", findString(okFunction));
		}
		if (null != id) {
			addParameter("id", findString(id));
		}
		if (null != focusOn) {
			addParameter("focusOn", findString(focusOn));
		}
		if (null != value) {
			addParameter("value", findString(value));
		}
		if (null != title) {
			addParameter("title", findString(title));
		}
		
	}	
}
